#! /usr/bin/python3
# -*- coding:utf-8 -*- 
# file: getopt_test.py
# author: wangchenxi
# mail: chinawangchenxi@gmail.com.cn
# brief: 
# version: 0.1.00
# Create Time:2019-06-01 22:50:32
# Last Update: 2019-06-01 23时19分09秒

import sys, getopt, pdb

def main(argv):
   inputfile = ''
   outputfile = ''
   try:
       opts, args = getopt.getopt(argv,"i:o:h",['help',"ifile=","ofile="])
   except getopt.GetoptError:
      print ('test.py -i <inputfile> -o <outputfile>')
      sys.exit(2)
   for opt, arg in opts:
      if opt in ('-h', '--help'):
         print ('test.py -i <inputfile> -o <outputfile>')
         sys.exit()
      elif opt in ("-i", "--ifile"):
         inputfile = arg
      elif opt in ("-o", "--ofile"):
         outputfile = arg
   print ('输入的文件为：', inputfile)
   print ('输出的文件为：', outputfile)

if __name__ == "__main__":
   pdb.set_trace()
   main(sys.argv[1:])
